package com.qys.livesMall.app.user.controller.sys;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.app.user.service.IH2AppUserBankService;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.app.user.model.dto.sys.QueryUserBankCardDTO;
import com.qys.livesMall.app.user.model.vo.sys.UserBankCardVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户银行卡表(UserBankCard)表控制层
 *
 * @author makejava
 * @since 2023-07-07 15:08:16
 */
@RestController
@RequestMapping("/sys/userBankCard")
@RequiredArgsConstructor
@Tag(name = "sys-用户银行卡管理", description = "sys-用户银行卡管理")
public class SysUserBankCardController {

    private final IH2AppUserBankService userBankService;
    /**
     * 分页查询所有数据
     *
     * @return 所有数据
     */
    @PostMapping("/selectAll")
    @Operation(summary = "分页查询所有数据")
    public R<Page<UserBankCardVO>> selectAll(@RequestBody QueryUserBankCardDTO dto) {
        return R.ok(userBankService.selectAll(dto));
    }

    /**
     * 删除数据
     *
     * @param idList 主键结合
     * @return 删除结果
     */
    @PostMapping("/delete")
    @Operation(summary = "删除数据")
    public R<?> delete(@RequestBody List<Long> idList) {
        userBankService.removeByIds(idList);
        return R.ok();
    }
}

